package cn.crm.dao;

import cn.crm.pojo.Product;
import cn.crm.pojo.Storage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface StorageDao extends BaseMapper<Storage> {
    @Select("SELECT * FROM `storage` s JOIN `product` p ON s.`stk_prod_id`=p.`prod_id`")
    @Results({
            @Result(property = "product",column = "stk_prod_id",
            javaType = Product.class,
            one = @One(select = "cn.crm.dao.ProductDao.selectById"))
    })
    Page<Storage> getStoragePageJoinProduct(Page<Storage> page);
}
